package h0725;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class IntegrateOfPrimes {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sqrt = (int) Math.sqrt(n);
        List<Integer> factors = new ArrayList<>();
        for (int i = 2; i <= sqrt; i++) {
            if ( n % i == 0) { //是质数而且取余为0
                //如果都是质数都加入进来
                if (isPrime(i)){
                    factors.add(i);
                }
                if (i!=n/i&&isPrime(n/i)){
                    factors.add(n/i);
                }
            }
        }
        System.out.println(getRes(factors, n));
    }

    private static String getRes(List<Integer> factors, int n) {
        for (int i = 0; i < factors.size(); i++) {
            for (int j = i; j < factors.size(); j++) {
                int a = factors.get(i);
                int b = factors.get(j);
                if (a * b == n) {
                    return a + " " + b;
                }
            }
        }
        return "-1 -1";
    }

    private static boolean isPrime(int n) {
        int sqrt = (int) Math.sqrt(n);
        if (n == 2) {
            return true;
        }
        if (n < 2) {
            return false;
        }
        //除了1和它本身
        for (int i = 2; i <= sqrt; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
}
